import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
//导入全局样式表
import './assets/css/global.css'
//import ElementUi from 'element-ui'
// import 'element-ui/lib/theme-chalk/index.css'
//导入axios
import axios from 'axios'
import qs from 'qs'
import treeTable from 'vue-table-with-tree-grid'
import VueQuillEditor from "vue-quill-editor";

//导入Nprogress对应的js和css包
import NProgress from 'nprogress'
axios.defaults.baseURL='http://120.27.246.168:8888/api/private/v1/';
//在request拦截器中展示进度条
axios.interceptors.request.use(config =>{
    NProgress.start()
    config.headers.Authorization=window.sessionStorage.getItem("token");
    return config
});
//Vue.use(ElementUi)
//在response拦截器中隐藏进度条,响应成功
axios.interceptors.response.use(config =>{
    NProgress.done()
    return config
})
Vue.prototype.$http=axios;
Vue.prototype.qs=qs;
//将富文本编辑器注册为全局可用的组件
Vue.use(VueQuillEditor)
Vue.config.productionTip = false;
Vue.component('treeTable',treeTable)
Vue.filter('dateFormat',function (val) {
    const Dte=new Date(val)
    const y=Dte.getFullYear()
    const m=(Dte.getMonth()+1+'').padStart(2,'0')
    const d=(Dte.getDate()+'').padStart(2,'0')
    const hh=(Dte.getHours()+'').padStart(2,'0')
    const mm=(Dte.getMinutes()+'').padStart(2,'0')
    const ss=(Dte.getSeconds()+'').padStart(2,'0')
    return y+'-'+m+'-'+d+' '+hh+':'+mm+':'+ss
})
new Vue({
    router,
    store,
    render: h => h(App)
}).$mount('#app');
